On-line system for measuring the efficiency of replacement algorithms

ABSTRACT

Technique for dynamically measuring the efficiency of a replacement algorithm in a virtual-memory data processing system. Each time the actual replacement algorithm effects the replacement of a &#39;&#39;&#39;&#39;block&#39;&#39;&#39;&#39; or &#39;&#39;&#39;&#39;page&#39;&#39;&#39;&#39; stored in the working memory, the measurement system automatically compares the number of such replacement that have been made with the number that would have been required by an assumed &#39;&#39;&#39;&#39;optimal&#39;&#39;&#39;&#39; replacement algorithm, the latter being unable to make its determinations in real time. The difference between the actual replacement count and the optimal replacement count is the number of unnecessary block transfers. The efficiency measurement functions are performed during those periods when the processor has been interrupted for a block replacement and is awaiting the entry of a newly demanded block into the working memory. Thus, the present system makes its efficiency measurements in an efficient manner. To accomplish this, the system utilizes an associative memory or equivalent storage mapping means having provisions for storing special reference bits (R&#39;&#39; bits) in the words respectively associated with the addresses in working memory. Each time a block stored in working memory is referenced by the processor, the R&#39;&#39; bit associated with that block is set. Then, when the next block replacement occurs, the measurement system is able, with the aid of these R&#39;&#39; bits, to update the optimal replacement pattern, or more specifically, to determine what blocks currently would have been present in the working memory if the optimal replacement algorithm had been followed and, therefore, whether the currently demanded replacement operation would have been necessary if said algorithm had been followed. The measurement system also is able to detect the occasional instances, if any, in which the actual replacement algorithm is able to avoid making a block replacement that the optimal algorithm would have found necessary. The system is further able to detect when, due to incomplete knowledge of the order of referencing, it is uncertain whether the optimal algorithm could have avoided making the currently demanded block replacement, and in such a case the system specifies a possible range of values for the replacement efficiency.

United States Patent [72] Inventor Lasflo A. Belady Yorktown Heights, N.Y.

[2 l Appl. No. 863,265

[22] Filed Oct. 2, 1969 {45] Patented May 4, 1971 [73] Assignee International Budness Machines Corporation Armonk, N.Y.

[S4] ON-LINE SYSTEM FOR MEASURING THE EFFICIENCY OF REPLACEMENT ALGORITHMS 10 Claims, 51 Drawing Figs.

Primary Examiner-Paul l Henon Assistant Examiner-Harvey E. Springborn Attorneys-Hamlin and .lancin and C. P. Boberg ABSTRACT: Technique for dynamically measuring the efficiency of a replacement algorithm in a virtual-memory data processing system. Each time the actual replacement algorithm effects the replacement of a "block" or page stored in the working memory, the measurement system automatically compares the number of such replacement that have been made with the number that would have been required by an assumed optimal" replacement algorithm, the latter being unable to make its determinations in real time. The difference between the actual replacement count and the optimal replacement count is the number of unnecessary block transfers. The efficiency measurement functions are performed during those periods when the processor has been interrupted for a block replacement and is awaiting the entry of a newly demanded block into the working memory. Thus, the present system makes its efficiency measurements in an efficient manner. To accomplish this, the system utilizes an associative memory or equivalent storage mapping means having provisions for storing special reference bits (R bits) in the words respectively associated with the addresses in working memory. Each time a block stored in working memory is referenced by the processor, the R bit associated with that block is set, Then, when the next block replacement occurs, the measurement system is able, with the aid of these R bits, to update the optimal replacement pattern, or more specifically, to determine what blocks currently would have been present in the working memory if the optimal replacement algorithm had been followed and, therefore, whether the currently demanded replacement operation would have been necessary if said algorithm had been followed. The measurement system also is able to detect the occasional instances, if any, in which the actual replacement algorithm is able to avoid making a block replacement that the optimal algorithm would have found necessary. The system is further able to detect when, due to incomplete knowledge of the order of referencing, it is uncertain whether the optimal algorithm could have avoided making the currently demanded block replacement, and in such a case the system specifies a possible range of values for the replacement efficiency.

REPLACED BLOCK TRANSFERRED OUT CPU) will u; w 2 852 CENTRAL WORKING CHANNEL 5 BA PROCESSING CHANNEL STORE umr MEMORY CONTROLS 1 REQUESTED BLOCK Ml.1 wuc THANEFERRED INTO WM WORKING Elam CONTROLS REQUEST SEARCH CONTROLS PATENTED MAY 4197! 3,577,185

SHEET 0? OF 47 T6 F| MEMORY mum FROM CPU 6 STORE BLOCK NUMBER AND L an m T 500 REGISTER HOLD" no IS THE REOUESTEDB n YES m womum; MEMORY 504 1000 TMUUU mcc ms AD 5 P on or MA nu ADDRESS- -aocx K ME66,ME8-ME27,ME42-NE65 m RH PORTION or or TORED R ans, UPDATE or P,A,E,G,B,U,L an T5,T6 EREVER NECESSARY mm #1006 on T 116-131 ENTER REQUESTED BLOCK mm vm 9 5- 1 m womuu DRESS SELECTED av N M RE EMENT ALGQRHHMI UPDATE REFERENCEIR) AND ucmc THE BLOCK FORMERLY ALTERATIONKAUBITS STORED THERE WORD CORRESPONDING sn CORRESPONDING R AND LBITS womum; ADDRESS or REQUESTED BLOCK 1001 ME1-ME37 IF L BIT FOR REQUESTED BLOCK -1,ADJUST A l U VALUES ACCORDINGLY.

IN ANY CASE, SET R BIT OF CORRESPONDING ANrlORD END PATENIED HAY 4 on SHEET 08 BF 47 H6. 7 mom nsouesr FROM CPU L l m {00? mo N0 IS THE REQUESTED oLocA ES 503 A m womuuc niuom wu? LooL HES) uses, T0,T1,T2,T3,T4 ME8-HE2T, T5 MHZ-m5 (FIG. 6)

moo Nous QR (F|G.6) sgmoso 505 (il6.6] T5,; 51o l DOES An. comm m M. wooo CORRESPONDING no AT LEAST ONE mo vcs T0 REQUESTED sLocA,

WITH ALL AND R ans SET :1 BIT-l soon ZERO? T6 n ns,n1,na,m

AovAucE WORD YES IS REQUESTED no POINTER T0 oLocA ALmEo? um 0-0 m COMBINATION 120 m 513 518 mm wooo ORIORDS m AAA. WORDCORRESPOMDING m Ml. mu AL BIT-i T0 REQUESTED BLOCK, AND R BIT-0 SET AL BIT-1 m 12am n4 n5 /5M ,549 ADVANCE wooo POINTER YES ARE ALL a ans on T0 um 1-0 couommoo sn T0 Q no 131 m,m,no,m

520 REPLACE oLocA M SELECTED RESET ATLJLOA ans ADDRESS m on mm mm,

mane AND REPLACE BLOCK AT SELECTED ADDRESS m vm T32,T33,T34iT35,T36,T37

PATENTEU m 4191:

SHEET 09 0F 47 MASK ARGUMENT T0 IIDR 20 BIT 14 ARGUMENT MASK BIT 3 ARGUMENT REGISTER BIT 14 MASK ARGUMENT BIT 2 ARGUMENT REGISTER BIT 3 c c n MASK ARGUMENT BIT 1 ARGUMENT REGISTER BIT 2 49 I III III ARGUMENT REGISTER BIT 1 FIG. 8D

FIG. 80

FIG. FIG. FIG.

8A 8B 8C FIG. 8

PATENTEDHAY 41911 3577185 -SHEET 12 OF 47 FIG. 8C 0 0 /AM I 2 so 94 {60 V [60 [B0 1 f woao 1 worm 1 WORD 1 wono 1 e111 BIT 2 BIT 3 an M 2 EL (READ-WRITE) (READ-WRITE) (READ-WRITE): mEAD-IRHE) 9s I so so so 94 J WORD 2 WORD 2 wono 2 WORD 2 1 BIT1 an 2 an a B\T M 62 s2 (READ-IRHE) (mo-1mm (READ-MUTE): UiEAD-IRHE) 9s i L All. 1 ill .1 L I 1 2 I so so so so 94 v L J WORD N WORD N WORD N WORD N BIT 1 BIT 2 BIT a an u s2 s2 (READ-11111151 (READ-WRITE) (READ-WRITE): mEAD-WRHE) 96 PATENTEDMAY 4m 3577,1825

SHEET 15 0F 47 BS8 E T23@ 1 3314 m 7 T23 223 1 330 /342 m 2 6 OR 7 a U4 OR G T34 L4 H 40 E 42 1 38 REPLACEMENT wm're ADDRESS CORE ADDRESS 5 :ggggii REGISTER REGISTER as i BACKUP s'rons i 2 m 223 REPLACE 1 CHANNEL 206 1s- 5 m 254 IRE-WRITE CONTROLS mnmncs J r W k l 2 .4 F m 298 29se s 22s- 2s4- E M 260 256 ,4 man? cons ADDRESS 1 muss FF 1 names BLOCK m 5 0 ADDRESS BLOCK 5 358 363 1 225' 23s T25 6 T36- c 5 WORKING sso- 25a see 262 MEMORY (cons) I 12s To m TO U 6 i T TGMDROFWH X 3,...- 11ml -1 I l 1-. 3)

llix rii-lxllu PATENTEU MY 4 l9 SHEET 1? OF 47 .o. 9 2S: j Em:

an: NE:

50 6 S m M .m

m3: :2 mm: Z

zuoJm 0H m w 44mm 4 .m

PATENTED MAY 4:971

SHEET 180F 47 ll." FNZI w 1 a H o mo 5.. M E! a 1 1 3i! M M Illa] M W w E: n. 5.533 5555 a mo, V N v $558 E532 5155 N3, Y o v x o mwhznou 1 15 [i122 W W w 555: m a M W I; E: a; 50 5 mil. w 3:. E laL Q w Z L. q mm 0K 1 w #11 m a; Z: *w 1 ii Q PAIENTED m 41971 SHEET 18 [1F 47 wax 3.. 3.. s a. N: s... E a... 3.. a... E 3.. 2 E E 

1. In a data processing system of the virtual-memory type wherein blocks of information are stored at numbered block addresses in a backup store and in some instances are stored also at working addresses temporarily associated with such block numbers in a high-speed working memory having a limited storage capacity, said system including a central processoR operable to request blocks of information according to their block numbers in said backup store and to reference such blocks when they are residing in said working memory and being effective whenever the block which it requests is currently stored only in the backup store to fetch the requested block from said store and enter the same into said memory at a working address therein selected according to a predetermined replacement algorithm, thereby replacing the block formerly stored at such working address; the method of measuring the efficiency of said predetermined replacement algorithm by progressively comparing the number of block replacements that actually are performed with an optimal number of block replacements which would have been performed had the processor been operated under the control of an optimal replacement algorithm that takes cognizance of all blocks which have resided and are about to reside in said memory, including the block currently requested by said processor, and the relative order in which such blocks have entered the memory, said method comprising the steps of: counting the actual number of replacement intervals that are initiated by said processor while it is operating under the control of said predetermined replacement algorithm, each such interval being initiated when said processor requests a block not currently stored in the working memory and being terminated when said processor next requests a block that is not then residing in said memory; marking with suitable indicia those working addresses at which blocks are referenced by said processor during each interval between successive block replacements; storing a table of index values which associates the identifying number of each block that has been requested by said processor with the number of the replacement interval in which such block most recently would have been referenced in the working memory according to said optimal replacement algorithm; causing said processor, as an incident to the initiation of each new replacement interval and prior to entry of the currently requested block into said memory, to make an updated determination of the optimal number of block replacement intervals that thus far would have been initiated if said processor had operated under the control of the optimal replacement algorithm, said determination being based upon said block referencing indicia and said stored index values, and manifesting a count of the unnecessary block transfers that have occurred between the backup store and the working memory according to the difference, if any, between the actual number of block replacement intervals and the optimal number of block replacement intervals.
 2. An efficiency measuring method as set forth in claim 1 further comprising the steps of: detecting the occurrence of a condition in which the processor references a requested block already present in said memory without initiating a new replacement interval at a time when, according to the optimal replacement algorithm, a new replacement interval would have had to be initiated by said processor in order to make the requested block available for referencing in said memory; and in response to the detection of such a condition, adjusting the optimal interval number and the unnecessary block transfer count consistently therewith.
 3. A replacement efficiency measuring method as set forth in claim 1 further comprising the steps of: detecting the occurrence of a condition in which the processor references a requested block already present in said memory without initiating a new replacement interval at a time when, according to the optimal replacement algorithm and depending also upon whether the actual order of referencing corresponds to the relative order in which the marked working addresses are arranged, a new replacement interval would have had to be initiated by said processor in order to make the requested block available for referencing in said memory; and, in Response to the detection of such a condition, manifesting an indication that the count of unnecessary block transfers may required adjustment in view of the fact that there has been an increase in the optimal number of replacement intervals without a corresponding increase in the actual number of replacement intervals.
 4. In a data processing system of the virtual-memory type wherein blocks of information are stored at numbered block addresses in a backup store and in some instances are stored also at working addresses temporarily associated with such block numbers in a high-speed working memory having a limited storage capacity of N blocks, said system including a central processor operable to request blocks of information according to their block numbers in said backup store and to reference such blocks when they are residing in said working memory and being effective whenever the block which it requests is currently stored only in the backup store to fetch the requested block from said store and enter the same into said memory at a working address therein selected according to a predetermined replacement algorithm, thereby replacing the block formerly stored at such working address; apparatus for measuring the efficiency of said predetermined replacement algorithm by progressively comparing the number of block replacements that actually are performed with an optimal number of block replacements which would have been performed had the processor been operated under the control of an optimal replacement algorithm that takes cognizance of all blocks which have resided and are about to reside in said memory, including the block currently requested by said processor, and the relative order in which such blocks have entered the memory, said apparatus comprising: means for counting the actual number of replacement intervals through which said system has operated under the control of said predetermined replacement algorithm in the course of attaining the current point in its program of operations; block reference storing means effective within each interval of the actual block replacement sequence for storing indicia designating which of the N blocks stored in the working memory are referenced by the processor during that interval only; intermittently operable computing means effective when operated to institute a computational procedure whereby said processor utilizes the indicia stored in said block reference storing means together with the identifying number of the currently requested block to determine the optimal number of replacement intervals in which the system could have attained the current point in its program of operations if it where functioning under the control of an optimal replacement algorithm evolved according to specific logical rules from the sequence in which the blocks have been requested by said processor; and enabling means for said computing means effective at the initiation of each interval in the actual sequence of operations to render said computing means operative for making an updated determination of the optimal interval number, whereby the processor executes said computational procedure at those times when the system is waiting for a currently requested block to be fetched from the backup store.
 5. Apparatus as set forth in claim 4 wherein said computing means includes the following: registering means effective each time said processor requests a block not then stored in the working memory to register the number of the block and the number of the optimal interval corresponding to the actual interval in which it is so requested; means for designating which of the intervals defined by the optimal replacement algorithm contain complete sets of block references, each complete-set interval consisting of a single interval in the optimal sequence of operations corresponding to one or more contemporary intervals in the actual sequence of operations during at least one of which the working memory contains N blocks all of which are referenced by said processor within a period that includes said single optimal interval and, if necessary, not more than N-1 succeeding optimal intervals; and means under the control of said registering means and said complete-set designating means for effectively excluding from the current determination of the optimal interval number all block requests that were made prior to the most recently designated complete-set interval.
 6. Apparatus as set forth in claim 5, further comprising: detecting means responsive to the block number requests registered by said registering means and responsive also to the optimal interval numbers determined by said computing means and said complete-set interval designations for detecting the occurrence of a condition in which a particular block has been permitted by said predetermined replacement algorithm to remain continuously in the working memory in an unreferenced state during a plurality of successive intervals in the actual sequence of operations corresponding to at least N successive intervals in the optimal sequence, commencing with a complete-set interval; and means controlled by said detecting means when it has detected the occurrence of such a condition, and operable in the event that the processor again references said particular block before it leaves the working memory, to increment the current optimal interval number without changing the current actual interval number, thereby effectively decrementing the count of unnecessary transfers charged to said predetermined replacement algorithm.
 7. In a data processing system of the kind wherein blocks of information are stored at numbered block addresses in a backup store and in some instances are stored also at working addresses temporarily associated with such block numbers in a high-speed working memory having a limited storage capacity of N blocks, said system including a central processor operable to request blocks of information according to their block numbers in said backup store and to reference such blocks when they are residing in said working memory and having block transfer instrumentalities effective whenever said processor requests a block currently stored only in the backup store to fetch the requested block from said store and enter the same into the working memory at a working address therein selected according to a predetermined replacement algorithm, thereby replacing the block formerly stored at such working address and causing the operation of the system to be divided into a succession of block replacement intervals, each interval commencing when the processor requests a block not currently stored in the working memory and terminating when the processor next requests a block that is not then residing in the working memory, the improvement consisting of an apparatus for enabling the replacement efficiency of the system to be dynamically measured while the system is operating under the control of said predetermined replacement algorithm, said apparatus comprising: means for counting the actual number of replacement intervals through which said system has operated under the control of said predetermined replacement algorithm in the course of attaining the current point in its program of operations; computing means for performing an optimization procedure wherein said processor determines the optimal number of replacement intervals in which the system could have attained the current point in its program of operations if it were functioning under the control of an optimal replacement algorithm evolved empirically from the sequence in which the blocks have been requested by said processor; the difference, if any, between the actual and optimal interval numbers representing the number of unnecessary block transfers chargeable to said predetermined replacement algorithm; said computing means including: registering means effective each time said processor requests a block not then stored in the wOrking memory to register the number of the block and the number of the optimal interval in which it is so requested; means for designating which of the intervals defined by the optimal replacement algorithm contain complete sets of block references, each complete-set interval consisting of a single interval in the optimal sequence of operations corresponding to one or more contemporary intervals in the actual sequence of operations during at least one of which the working memory contains N blocks all of which are referenced by said processor within a period that includes said single optimal interval and, if necessary, not more than N-1 succeeding optimal intervals; and means under the control of said registering means and said complete-set designating means for effectively excluding from the current determination of the optimal interval number all block requests that were made prior to the most recently designated complete-set interval; detecting means responsive to the block number requests registered by said registering means and responsive also to the optimal interval numbers determined by said computing means and to said complete-set interval designations for detecting the occurrence of a condition in which a particular block has been permitted by said predetermined replacement algorithm to remain continuously in the working memory in an unreferenced state during a plurality of successive intervals in the actual sequence or operations corresponding to at least N successive intervals in the optimal sequence, commencing with a complete-set interval; and means controlled by said detecting means when it has detected the occurrence of such a condition, and operable in the event that the processor again references said particular block before it leaves the working memory, to increment the current optimal interval number without changing the current actual interval number, thereby effectively decrementing the count of unnecessary transfers charged to said predetermined replacement algorithm.
 8. In a data processing system of the kind wherein blocks of information are stored at numbered block addresses in a backup store and in some instances are stored also at working addresses temporarily associated with such block numbers in a high-speed working memory having a limited storage capacity of N blocks, said system including a central processor operable to request blocks of information according to their block numbers in said backup store and to reference such blocks when they are residing in said working memory and having block transfer instrumentalities effective whenever said processor requests a block currently stored only in the backup store to fetch the requested block from said store and enter the same into the working memory at a working address therein selected according to a predetermined replacement algorithm, thereby replacing the block formerly stored at such working address and causing the operation of the system to be divided into a succession of block replacement intervals, each interval commencing when the processor requests a block not currently stored in the working memory and terminating when the processor next requests a block that is not then residing in the working memory, the improvement consisting of an on-lines efficiency measurement apparatus for progressively determining, with the aid of said processor, how many of the block replacements effected under the control of said predetermined replacement algorithm were performed unnecessarily as a result of previous inconsistent replacement decisions executed under the control of said algorithm, said apparatus comprising: interval indexing means for assigning a succession of actual interval numbers (P) respectively to the successive intervals in the actual sequence of block entry and replacement operations performed by said block transfer instrumentalities under the control of said predetermined replacement algorithm; optimization means for defining a succeSsion of optimal intervals according to an assumed optimal sequence of block entry and replacement operations evolved empirically from the actual sequence of block requests made by said processor and for assigning numbers (A) consecutively to such optimal intervals; the difference, if any, between the current values of said actual interval number (P) and said optimal interval number (A) at any given time representing the number of unnecessary block transfers (U) performed by said processor under the control of said predetermined replacement algorithm as of said given time, said optimization means including: block indexing means for storing variable block index values (E), one for each block number which has been requested by the processor, the current index value of each block representing the number of the optimal interval in which the respective block would have been most recently referenced in the optimal sequence of operations; counter table means having selectable storage positions addressable according to the numbers representing the respective intervals in the optimal sequence of operations, each such position being adapted to store a variable counter value (C) that is capable of being stepped through a range of values having zero and N-1 as its limits, the first such limiting value being assigned to the selected interval the first time that said processor makes reference to a block whose index value (E) corresponds to the number of that interval; counter table adjusting means effective each time the processor makes reference to a different block having the same block index value (E) to step the counter value (C) for the corresponding interval by 1 toward its second limiting value, whereby a selected one of the counter values (C) attains its second limit each time a set of N blocks having same index value (E) is referenced by said processor; complete-set interval numbering means initially settable to a starting value (e.g., 1) and effective each time a counter value in said counter table means attains its second limiting value to register the number of the corresponding optimal interval as the current complete-set interval number (B), said number, when greater than said starting value, being equal to the number of the most recent interval in the optimal sequence of operations when the N blocks stored in the working memory could have been referenced by said processor within a period including such interval and, if necessary, not more than N-1 succeeding intervals in said optimal sequence; block index adjusting means effective each time a block having an index value (E) lower than the current setting (B) of the complete-set interval numbering means is requested by said processor to increment the optimal interval number (A) and set the index value (E) of such block equal to the incremented value of the optimal interval number (A); said optimization means normally being in an unoperated state; block reference registering means including, for each block storage address in the working memory, a storage device settable to store a reference bit (R'') which indicates by its value (1 or 0) whether or not the block stored at the corresponding address in the working memory has been referenced at least once by said processor since the most recent block replacement was effected under the control of said predetermined replacement algorithm; and updating means controlled by the reference bits (R'') stored in said block reference registering means and effective each time said processor requests a block of information not then stored in said working memory to cause an updating operation of said optimization means in accordance with the identities of the respective blocks which have been referenced in the working memory during the interval that terminated with the current block request, thereby updating the optimal interval number (A), the block index values (E), the counter values (C) and the coMplete-set interval number (B), such action occurring at times when the system is waiting for block replacements.
 9. Apparatus as set forth in claim 8, further comprising: detecting means responsive to the block index values (E) and responsive also to the optimal interval number (A) and to the complete-set interval numbers (B) for detecting a condition in which a particular block has been permitted by said predetermined replacement algorithm to remain continuously in the working memory in an unreferenced state during a plurality of successive intervals in the actual sequence of operations corresponding to at least N successive intervals in the optimal sequence, commencing with a complete-set interval; and means controlled by said detecting means when it has detected the occurrence of such a condition, and operable in the event that the processor again references said particular block before it leaves the working memory, to increment the current optimal interval number (A) without changing the current actual interval number (P), thereby effectively decrementing the count of unnecessary transfers (U) charged to said predetermined replacement algorithm.
 10. In a data processing system of the kind wherein blocks of information are stored at numbered block addresses in a backup store and in some instances are stored also at working addresses temporarily associated with such block numbers in a high-speed working memory having a limited storage capacity of N blocks, said system including a central processor operable to request blocks of information according to their block numbers in said backup store and to reference such blocks when they are residing in said working memory and having block transfer instrumentalities effective whenever said processor requests a block currently stored only in the backup store to fetch the requested block from said store and enter the same into the working memory at a working address therein selected according to a predetermined replacement algorithm, thereby replacing the block formerly stored at such working address and causing the operation of the system to be divided into a succession of block replacement intervals, each interval commencing when the processor requests a block not currently stored in the working memory and terminating when the processor next requests a block that is not then residing in the working memory, the improvement consisting of an on-line efficiency measurement apparatus for progressively determining, with the aid of said processor, how many of the block replacements effected under the control of said predetermined replacement algorithm were performed unnecessarily as a result of previous inconsistent replacement decisions executed under the control of said algorithm, said apparatus comprising: interval indexing means for assigning a succession of actual interval numbers (P) respectively to the successive intervals in the actual sequence of block entry and replacement operations performed by said block transfer instrumentalities under the control of said predetermined replacement algorithm; optimization means for defining a succession of optimal intervals according to an assumed optimal sequence of block entry and replacement operations evolved empirically from the actual sequence of block requests made by said processor and for assigning numbers (A) consecutively to such optimal intervals; the difference, if any, between the current values of said actual interval number (P) and said optimal interval number (A) at any given time representing the number of unnecessary block transfers (U) performed by said processor under the control of said predetermined replacement algorithm as of said given time, said optimization means including: block indexing means for storing variable block index values (E), one for each block number which has been requested by the processor, the current index value of each block representing the number of the optimal interval in whIch the respective block would have been most recently referenced in the optimal sequence of operations; counter table means having selectable storage positions addressable according to the numbers representing the respective intervals in the optimal sequence of operations, each such position being adapted to store a variable counter value (C) that is capable of being stepped through a range of values having zero and N-1 as its limits, the first such limiting value being assigned to the selected interval the first time that said processor makes reference to a block whose index value (E) corresponds to the number of that interval; counter table adjusting means effective each time the processor makes reference to a different block having the same block index value (E) to step the counter value (C) for the corresponding interval by 1 toward its second limiting value, whereby a selected one of the counter values (C) attains its second limit each time a set of N blocks having the same index value (E) is referenced by said processor; complete-set interval numbering means initially settable to a starting value (e.g., 1) and effective each time a counter value in said counter table means attains its second limiting value to register the number of the corresponding optimal interval as the current complete-set interval number (B), said number, when greater than said starting value, being equal to the number of the most recent interval in the optimal sequence of operations when the N blocks stored in the working memory could have been referenced by said processor within a period including such interval and, if necessary, not more than N-1 succeeding intervals in said optimal sequence; block index adjusting means effective each time a block having an index value (E) lower than the current setting (B) of the complete-set interval numbering means is requested by said processor to increment the optimal interval number (A) and set the index value (E) of such block equal to the incremented value of the optimal interval number (A); detecting means responsive to the block index values (E) and responsive also to the optimal interval number (A) and to the complete-set interval numbers (B) for detecting a condition in which a particular block has been permitted by said predetermined replacement algorithm to remain continuously in the working memory in an unreferenced state during a plurality of successive intervals in the actual sequence of operations corresponding to at least N successive intervals in the optimal sequence, commencing with a complete-set interval; and means controlled by said detecting means when it has detected the occurrence of such a condition, and operable in the event that the processor again references said particular block before it leaves the working memory, to increment the current optimal interval number (A) without changing the current actual interval number (P), thereby effectively decrementing the count of unnecessary transfers (U) charged to said predetermined replacement algorithm. 